]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell/app: Use launch context for new-window gtk action
authorSebastian Keller <skeller@gnome.org>
Wed, 11 Feb 2026 15:58:17 +0000 (16:58 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 13 Sep 2026 17:39:10 +0000 (19:39 +0200)
Without a proper launch context activating the new-window action would
not place the new window on the expected workspace.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4071>
(cherry picked from commit a5507adaa440a0c53354c15fc96902b01bc2e8bd)

src/shell-app.c

index 209ac8f16dc5f0236064f3ba7281d53753823203..409973b711353644b645392ee84d887988b1ce12 100644 (file)
@@ -534,6 +534,38 @@ shell_app_activate_full (ShellApp      *app,
     }
 }
 
+static GVariant *
+get_platform_data (ShellApp *app,
+                   guint     timestamp,
+                   int       workspace)
+{
+  GVariantBuilder builder;
+  ShellGlobal *global;
+  g_autoptr (GAppLaunchContext) context = NULL;
+  gchar *startup_id;
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
+
+  global = shell_global_get ();
+  context = shell_global_create_app_launch_context (global, timestamp, workspace);
+
+  if (!context)
+    return g_variant_builder_end (&builder);
+
+  startup_id = g_app_launch_context_get_startup_notify_id (context, NULL, NULL);
+
+  if (!startup_id)
+    return g_variant_builder_end (&builder);
+
+
+  g_variant_builder_add (&builder, "{sv}",
+      "desktop-startup-id", g_variant_new_string (startup_id));
+  g_variant_builder_add (&builder, "{sv}",
+      "activation-token", g_variant_new_take_string (g_steal_pointer (&startup_id)));
+
+  return g_variant_builder_end (&builder);
+}
+
 /**
  * shell_app_open_new_window:
  * @app: a #ShellApp
@@ -574,8 +606,8 @@ shell_app_open_new_window (ShellApp      *app,
       g_action_group_has_action (group, "app.new-window") &&
       g_action_group_get_action_parameter_type (group, "app.new-window") == NULL)
     {
-      g_action_group_activate_action (group, "app.new-window", NULL);
-
+      gtk_action_muxer_activate_action_full (GTK_ACTION_MUXER (group), "app.new-window",
+                                             NULL, get_platform_data (app, 0, workspace));
       return;
     }
 
@@ -1465,38 +1497,6 @@ object_path_from_app_id (const gchar *app_id)
   return app_id_path;
 }
 
-static GVariant *
-get_platform_data (ShellApp *app,
-                   guint     timestamp,
-                   int       workspace)
-{
-  GVariantBuilder builder;
-  ShellGlobal *global;
-  g_autoptr (GAppLaunchContext) context = NULL;
-  gchar *startup_id;
-
-  g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
-
-  global = shell_global_get ();
-  context = shell_global_create_app_launch_context (global, timestamp, workspace);
-
-  if (!context)
-    return g_variant_builder_end (&builder);
-
-  startup_id = g_app_launch_context_get_startup_notify_id (context, NULL, NULL);
-
-  if (!startup_id)
-    return g_variant_builder_end (&builder);
-
-
-  g_variant_builder_add (&builder, "{sv}",
-      "desktop-startup-id", g_variant_new_string (startup_id));
-  g_variant_builder_add (&builder, "{sv}",
-      "activation-token", g_variant_new_take_string (g_steal_pointer (&startup_id)));
-
-  return g_variant_builder_end (&builder);
-}
-
 static void
 on_activate_action_cb (GObject      *source,
                        GAsyncResult *res,